package com.work.cos.service.impl.msg;

import java.util.List;

import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.work.cos.domain.entity.SystemConfigEntity;
import com.work.cos.mapper.base.ISystemConfigMapper;
import com.work.cos.service.interfc.ISystemConfigService;
import com.work.cos.util.page.PageInfo;

@Service
public class SystemConfigImpl implements ISystemConfigService{
	
	@Autowired
	private ISystemConfigMapper systemConfigMapper;

	@Override
	public String getSystemConfigByConfigKey(String configKey) {
		return this.systemConfigMapper.findSystemConfigByConfigKey(configKey).getConfigValue();
	}

	@Override
	public String getConfigValueByConfigKey(String configKey) {
		return this.systemConfigMapper.findConfigValueByConfigKey(configKey);
	}

	@Override
	public List<SystemConfigEntity> findAllSystemConfigList() {
		return this.systemConfigMapper.findAllSystemConfig();
	}

	@Override
	public boolean updateSystemConfig(String configKey,String configValue) {
		return  this.systemConfigMapper.updateSystemConfig(configKey, configValue) > 0;
	}

	@Override
	public PageInfo<SystemConfigEntity> findSystemConfigByNameAndConfigKey(SystemConfigEntity systemConfigInfo) {
		List<SystemConfigEntity> page = this.systemConfigMapper.findSystemConfigByNameAndKey(systemConfigInfo);
		int total = this.systemConfigMapper.findCountByNameAndKey(systemConfigInfo);
		return null;
	}

	
	@Override
	public SystemConfigEntity getSystemConfigById(Long id){
		return this.systemConfigMapper.getSystemConfigById(id);
	}
	@Override
	public boolean updateAllSystemConfig(SystemConfigEntity systemConfig){
		return 1 == this.systemConfigMapper.updateAllSystemConfig(systemConfig);
	}
	@Override
	public boolean deleteSystemConfig(Long id){
		return 1 == this.systemConfigMapper.deleteSystemConfig(id);
	}

	@Override
	public List<SystemConfigEntity> getSystemConfigList(SystemConfigEntity systemConfigInfo){
		return this.systemConfigMapper.getSystemConfigList(systemConfigInfo);
	}

	@Override
	public List<SystemConfigEntity> findSystemToDownList(SystemConfigEntity config) {
		return this.systemConfigMapper.findSystemToDownList(config);
	}

	@Override
	public PageInfo<SystemConfigEntity> findSystemConfigByConfigKey(String configKey) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean addSystemConfig(SystemConfigEntity systemConfig) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public SystemConfigEntity getSystemConfigInfoByConfigKey(String configKey) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public double getMultiDispatchPrice() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public double getMultiBasePrice() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getLogisticUrl() {
		// TODO Auto-generated method stub
		return null;
	}
}
